package com.example.broadcast_offline;

import android.app.Activity;

import java.util.ArrayList;
import java.util.List;

public class ActivityConllector {
    public static List<Activity> activities = new ArrayList<>();


    public static void addActivity(Activity activity) {
        activities.add(activity);
    }

    public static void removeActivity(Activity activity) {
        activities.remove(activity);
    }

    public static void finishAll() {
        for (Activity activity : activities) {
            if (!activity.isFinishing()) {//检查活动是否停止
                activity.finish();   //将每一个活动就结束     一个广播控制的是很多活动 需要一个list 存储已经 启动的活动
            }
        }
    }
}
